home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / libs / x / xview / xview3.004 / xview3 / usr / openwin / include / xview_private / windowimpl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-29  |  8.8 KB  |  261 lines

  1. /*      @(#)windowimpl.h 20.83 93/06/28 SMI      */
  2.  
  3. /***********************************************************************/
  4. /*                          window_impl.h                   */
  5. /*    
  6.  *    (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents 
  7.  *    pending in the U.S. and foreign countries. See LEGAL NOTICE 
  8.  *    file for terms of the license. 
  9.  */
  10. /***********************************************************************/
  11.  
  12. #ifndef window_impl_DEFINED
  13. #define window_impl_DEFINED
  14.  
  15. #include <sys/types.h>
  16. #include <sys/time.h>
  17.  
  18. #include <xview/font.h>
  19. #include <xview/pkg.h>
  20. #define    _NOTIFY_MIN_SYMBOLS
  21. #include <xview/notify.h>
  22. #undef    _NOTIFY_MIN_SYMBOLS
  23. #include <xview/rect.h>
  24. #include <xview/rectlist.h>
  25.  
  26. /* BUG: try to get rid of win_struct.h */
  27. #include <xview/win_struct.h>
  28. #include <xview/win_input.h>
  29. #include <xview/window.h>
  30. #include <X11/Xutil.h>
  31.  
  32. #include <xview/cursor.h>
  33. #include <xview_private/draw_impl.h>
  34. #include <xview_private/xv_list.h>
  35. #include <xview_private/portable.h>
  36. #include <xview/dragdrop.h>
  37.  
  38. #ifdef OW_I18N
  39. #include <xview_private/i18n_impl.h>
  40. #endif
  41.  
  42. #define window_attr_next(attr) (Window_attribute *)attr_next((caddr_t *)attr)
  43.  
  44. /* 
  45.    MAX_FUNC_KEY is maximum number of function keys + number of buttons in the
  46.    mouse.
  47. */
  48. #define MAX_KEYCODE        128
  49. #define BITS_PER_BYTE        8
  50. #define WINDOW_KEYMASK        (MAX_KEYCODE/((sizeof(char))* BITS_PER_BYTE))
  51.  
  52. #define DEFAULT_X_Y        0
  53. #define DEFAULT_WIDTH_HEIGHT    64
  54.  
  55. /* For the rect of the window */
  56. #define         EMPTY_VALUE                     0x7fff
  57.  
  58.  
  59. #define WIN_DEFAULT_RECT(_rect) (((_rect)->r_left == DEFAULT_X_Y) && \
  60.                  ((_rect)->r_top == DEFAULT_X_Y) && \
  61.                  ((_rect)->r_width == DEFAULT_WIDTH_HEIGHT) && \
  62.                  ((_rect)->r_height == DEFAULT_WIDTH_HEIGHT)) 
  63.  
  64. #define    WIN_PRIVATE(win)    XV_PRIVATE(Window_info, Xv_window_struct, win)
  65. #define    WIN_PUBLIC(win)        XV_PUBLIC(win)
  66.  
  67. #define WIN_SET_DEAF(_win_info, flag) (_win_info->deaf = flag)
  68. #define WIN_IS_DEAF(_win_info) (_win_info->deaf)
  69.  
  70. #define WIN_SET_LOOP(_win_info, flag) (_win_info->window_loop = flag)
  71. #define WIN_IS_LOOP(_win_info) (_win_info->window_loop)
  72.  
  73. #ifdef OW_I18N
  74. #define WIN_SET_GRAB(_win_info, flag) (_win_info->active_grab = flag)
  75. #define WIN_IS_GRAB(_win_info) (_win_info->active_grab)
  76.  
  77. #define WIN_SET_PASSIVE_GRAB(_win_info, flag) (_win_info->passive_grab = flag)
  78. #define WIN_IS_PASSIVE_GRAB(_win_info) (_win_info->passive_grab)
  79. #endif /* OW_I18N */
  80.  
  81. /* windows are in charge of their own borders */
  82.  
  83. /***********************************************************************/
  84. /*                Structures                        */
  85. /***********************************************************************/
  86. typedef struct window_client_msg {
  87.     Xv_opaque        type;
  88.     unsigned char    format;
  89.     union {
  90.         char        b[WIN_MESSAGE_DATA_SIZE];
  91.     short        s[WIN_MESSAGE_DATA_SIZE/sizeof(short)];
  92.     int        l[WIN_MESSAGE_DATA_SIZE/sizeof(int)];
  93.     } data;
  94. } Window_client_msg;
  95.  
  96. typedef struct win_drop_site_list {
  97.     Xv_sl_link          next;
  98.     Xv_drop_site     drop_item;
  99. } Win_drop_site_list;
  100.  
  101. typedef enum win_drop_site_mode {
  102.     Win_Drop_Site,
  103.     Win_Drop_Interest,
  104. } Win_drop_site_mode;
  105.  
  106. typedef struct window_info {
  107.     Xv_Window         public_self;         /* back pointer to public struct */
  108.     int            (*layout_proc)();
  109.     void                (*event_proc)();
  110.     void                (*notify_safe_event_proc)();
  111.     void                (*notify_immediate_event_proc)();
  112.     struct window_info    *owner;
  113.     Xv_Window         parent;
  114.     Xv_opaque         menu;
  115.     Xv_font         font;
  116.     Xv_Font         glyph_font;      /* OL glyph font for window's scale */
  117.     int             desired_width;
  118.     int             desired_height;
  119.     Xv_Cursor         cursor;
  120.     Xv_Cursor         normal_cursor;     /* A place to store normal cursor */
  121.                         /* when switching to busy cursor  */
  122.     Xv_opaque         client_data; 
  123.     Rect         cache_rect;
  124.     unsigned int     xmask;                     /* X event mask */
  125.     int              scale;
  126.     char        *cmdline;
  127.     Pixmap         background_pixmap;
  128.     Window_client_msg     client_message;            /* Client Message Info */
  129.     Win_drop_site_list  *dropSites;          /* Drop sites in the window */
  130.     Win_drop_site_list  *dropInterest; /* Only used in top-level windows.
  131.                     * Holds the list of drop items.       */
  132.  
  133.     /* margin info */
  134.     short         top_margin;
  135.     short         bottom_margin;
  136.     short         left_margin;
  137.     short         right_margin;
  138.     short         row_height;
  139.     short         column_width;
  140.     short         row_gap;
  141.     short         column_gap;
  142.  
  143.     /* flags */
  144.     unsigned         has_kbd:1;
  145.     unsigned         map:1;              /* change to map when ready */
  146.     unsigned         rect_info:4;        /* x, y, width, or height set */
  147.     unsigned         top_level:1; 
  148.     unsigned         top_level_no_decor:1;     /* does window have decors */
  149.     unsigned         created:1; 
  150.     unsigned         has_border:1;             /* does window have border */
  151.     unsigned         being_rescaled:1;
  152.     unsigned          input_only:1;            /* is the window input only */
  153.     unsigned          transparent:1;          /* is background pixmap=None */
  154.     unsigned          in_fullscreen_mode:1;   /* window in fullscreen mode */
  155.     unsigned          is_client_pane:1;     /* is the window a client pane */
  156.     unsigned         x_paint_window:1;      /* window used for X graphics */
  157.     unsigned         inherit_colors:1;
  158.     unsigned         no_clipping:1;     /* dont set clip rects on repaint */
  159.     unsigned         collapse_exposures:1;      /* colapse expose events  */
  160.                             /* into a single event.   */
  161.                             /* count = 0              */
  162.     unsigned             collapse_motion_events:1;  /* colapse motion events  */
  163.     unsigned         deaf:1;                         /* is window deaf? */
  164.     unsigned         window_loop:1;          /* is window in window_loop? */
  165.     unsigned         softkey_flag:1;          /* is soft key labels set? */
  166. #ifdef OW_I18N
  167.     unsigned         win_use_im:1;      /* does window need an input method? */
  168.     unsigned         ic_conversion:1;              /* is IC conversion on */
  169.     unsigned         ic_created:1;                       /* is IC created */
  170.     unsigned         ic_active:1;     /*is IC active? for read-only modes */
  171.     unsigned             active_grab:1;           /* is window in active grab */    
  172.     unsigned             passive_grab:1;           /* is window in passive grab
  173. */
  174.  
  175.     /* input method data */
  176.     XIC             xic;                  /* X Input Context (IC) */
  177.     XID             ic_focus_win;                   /* IC focus window */
  178.     XID             tmp_ic_focus_win;              /* temp IC focus window */
  179.     char         *win_ic_committed;   /* mbyte implicit commit string */
  180.     wchar_t         *win_ic_committed_wcs;/*widec implicit commit string */
  181.     XIMCallback          start_pecb_struct;        /* preedit start callback */
  182.     XIMCallback          draw_pecb_struct;         /* preedit draw callback */
  183.     XIMCallback          caret_pecb_struct;        /* preedit caret callback */
  184.     XIMCallback          done_pecb_struct;         /* preedit done callback */
  185.     XIMCallback          start_stcb_struct;         /* status start callback */
  186.     XIMCallback          draw_stcb_struct;          /* status draw callback */
  187.     XIMCallback          done_stcb_struct;          /* status done callback */
  188. #ifdef FULL_R5
  189.     unsigned long     x_im_style_mask;     /* X input method style mask */
  190. #endif /* FULL_R5 */
  191. #endif /* OW_I18N */
  192.  
  193. } Window_info;
  194.  
  195.  
  196. /* 
  197.  * Package private
  198.  */
  199.  
  200. #define    actual_row_height(win)         \
  201.     (win->row_height ? win->row_height : \
  202.                 xv_get(win->font, FONT_DEFAULT_CHAR_HEIGHT))
  203.  
  204. #ifdef OW_I18N
  205. #define    actual_column_width(win)         \
  206.     (win->column_width ? win->column_width : \
  207.                  xv_get(win->font, FONT_COLUMN_WIDTH))
  208. #else /* OW_I18N */
  209. #define    actual_column_width(win)         \
  210.     (win->column_width ? win->column_width : \
  211.                  xv_get(win->font, FONT_DEFAULT_CHAR_WIDTH))
  212. #endif /* OW_I18N */
  213.  
  214. #define    actual_rescale_row_height(par,win) \
  215.     (win->row_height ? win->row_height :   \
  216.                 xv_get(par->font, FONT_DEFAULT_CHAR_HEIGHT))
  217.  
  218. #ifdef OW_I18N
  219. #define    actual_rescale_column_width(par,win) \
  220.     (win->column_width ? win->column_width : \
  221.                 xv_get(par->font, FONT_COLUMN_WIDTH))
  222. #else /* OW_I18N */
  223. #define    actual_rescale_column_width(par,win) \
  224.     (win->column_width ? win->column_width : \
  225.                 xv_get(par->font, FONT_DEFAULT_CHAR_WIDTH))
  226. #endif /* OW_I18N */ 
  227.  
  228. /* window.c */
  229. Pkg_private Notify_value    window_default_event_func();
  230. Xv_private int            window_getrelrect();
  231.  
  232. /* window_set.c */
  233. Pkg_private Xv_opaque        window_set_avlist();
  234. Pkg_private int            win_appeal_to_owner();
  235.  
  236. /* window_get.c */
  237. Pkg_private Xv_opaque        window_get_attr();
  238.  
  239. /* window_layout.c */
  240. Pkg_private int            window_layout();
  241.  
  242. /* window_compat.c */
  243. Xv_private void            window_scan_and_convert_to_pixels();
  244.  
  245. /* windowdrop.c */
  246. Pkg_private void        win_add_drop_item();
  247. Pkg_private Xv_opaque        win_delete_drop_item();
  248. Pkg_private void        win_add_drop_interest();
  249. Pkg_private void        win_update_dnd_property();
  250. Xv_private Xv_opaque        win_get_top_level();
  251.  
  252. /* windowutil.c */
  253. Xv_private void            win_set_wm_command();
  254. Xv_private void            win_set_wm_class();
  255. Xv_private int            window_set_tree_flag();
  256. Xv_private int            window_set_tree_child_flag();
  257. Xv_private int            window_set_flag_cursor();
  258.  
  259.  
  260. #endif /* ~window_impl_DEFINED */
  261.